Telemetry - #21
Conversation
paulswartz
left a comment
There was a problem hiding this comment.
Thanks for writing this up! This is a great overview of the approach.
| 3. **Traces** - are the representations of individual requests or transactions that flow through a system, which can help identify bottlenecks, dependencies, and root causes of issues. | ||
|
|
||
| TID engineers currently make extensive use of logging. | ||
| But, we don't currently have an established mechanism for collecting metrics or traces. |
There was a problem hiding this comment.
suggestion: we do have an "established mechanism for collecting metrics" at least, based on the definition above ("numerical measurements of system performance and behavior"). We have CPU/memory usage, response times, &c, already, via structured logs.
There was a problem hiding this comment.
The fact that we can log numerical values does not make them metrics. Metrics are stored and accessed differently, so they must be placed in a metric-specific index.
There was a problem hiding this comment.
Is there another definition of metrics that talks about their storage and access? The definition you used above doesn't appear to include that.
| - You are concerned about your ECS resource usage. | ||
|
|
||
| The UF sidecar uses CPU and memory resources. | ||
| Though the footprint is small, you might be worried that increasing your compute usage might affect the rest of your cluster. |
There was a problem hiding this comment.
question: do we know what the footprint is for UF running in ECS?
There was a problem hiding this comment.
These are the published requirements: https://docs.splunk.com/Documentation/Forwarder/9.2.0/Forwarder/Deploy. For dotcom, we use 4 3GHz processors and 16GB of RAM. So, the UF would be 1.5/12 12.5% of the CPU and 3% of RAM.
There was a problem hiding this comment.
It's a sidecar though, correct? So it's additional resources (not many it sounds like), but some.
| But, as noted above, logs are just one of three tools used to observe systems. | ||
| Metrics are optimized for storage and retrieval as numbers in a time series, which makes them cheap to store and fast to retrieve. | ||
|
|
||
| By adopting metrics, we can speed up slow queries, decrease the time necessary to generate dashboards and reports, and make previously impossible alerts possible. |
There was a problem hiding this comment.
question: do you have examples of "impossible alerts"?
There was a problem hiding this comment.
Yeah, let's say you want to know if the number of requests you received over the last minute was anomalous. You would want to compare that minute to other bins over the past week. Looking at logs over the past week takes too long...because they aren't optimized to be viewed that way.
There was a problem hiding this comment.
We have a alert which does this for another application already: search for "Concentrate: Unusual Metric Drop" in the Splunk alerts.
|
|
||
| By adopting metrics, we can speed up slow queries, decrease the time necessary to generate dashboards and reports, and make previously impossible alerts possible. | ||
|
|
||
| Furthermore, we can decrease costs by reducing the data we send to Splunk. |
There was a problem hiding this comment.
question: does reducing the data we send to Splunk reduce our costs? It would also be interesting to compare with the additional resources needed to run the UF sidecar.
There was a problem hiding this comment.
We pay for ingestion. Ingesting a log for every request (150 per second * 60 seconds) versus one metric for a minute is a 9,000:1 ratio.
There was a problem hiding this comment.
Are we going to stop logging a message for each request?
| But, as noted above, logs are just one of three tools used to observe systems. | ||
| Metrics are optimized for storage and retrieval as numbers in a time series, which makes them cheap to store and fast to retrieve. | ||
|
|
||
| By adopting metrics, we can speed up slow queries, decrease the time necessary to generate dashboards and reports, and make previously impossible alerts possible. |
There was a problem hiding this comment.
question: do we have a comparison about how much time it takes currently to make dashboards, and how much it'll take with the new metrics collection approach?
There was a problem hiding this comment.
This doesn't mean how long it takes to create the dashboard but to render it.
There was a problem hiding this comment.
I haven't seen an issue with dashboard queries taking a long time, so I was hoping you had examples of where metrics would measurably improve things. For example, the API and Dotcom dashboards seems to load quickly enough?
| # Motivation | ||
|
|
||
| Logs are handy for debugging and other unstructured research like a security audit. | ||
| However, many TID developers have noted that some queries based on logs are incredibly slow, if not impossible, to run. |
There was a problem hiding this comment.
suggestion: it would be good to include some examples here.
There was a problem hiding this comment.
If you take your example below and run it over a week. Took me 2 minutes and 30 seconds. Now, imagine loading a dashboard looking over the past week. It takes minutes to load. This is a real-world example from when I tried to find a good day/time to release the new caching work where we would have the fewest visitors and, therefore, incur the least risk.
There was a problem hiding this comment.
It's 3:30 - 4am, and it took under 10 seconds for 7 days worth of data; 30 days took 25 seconds. I'm sure a true timeseries database would be faster, but how often are we making these queries such that the extra speed is worth the complexity?
It sounds like knowledge about how to effectively query Splunk isn't well-distributed; I'll talk with Ryan about scheduling a lunch-and-learn sometime! This document with some ideas about what people are looking for will definitely be helpful.
|
|
||
| - You maintain non-Elixir applications and do not want to write a method of getting metrics into Splunk. | ||
|
|
||
| There aren't any libraries in other languages that transmit metrics to Splunk via the HEC. |
There was a problem hiding this comment.
question: if we're maintaining a library to do this for Elixir, why wouldn't we maintain one for other languages we use?
There was a problem hiding this comment.
We predominately use Elixir. So, it would make more sense to offer it as an option. The same ROI would not exist for languages we use less frequently.
|
|
||
| You can argue that we do not need metrics and that adding a means to collect them increases the complexity of our technology stack. | ||
| However, we hope the limitations of a logs-only approach to observability have been made apparent by this RFC. | ||
| Furthermore, we hope that the promised benefits of metrics cause excitement. |
There was a problem hiding this comment.
suggestion: some other drawbacks offhand:
- additional resource usage for the Universal Forwarder
- need to keep the UF up-to-date
- possibly trickier to manage the connection to Splunk (vs. relying on ECS)
some questions:
- how do we monitor the UF?
- how does the UF handle being spun up / spun down elastically?
There was a problem hiding this comment.
I have addressed the resource usage above. It's a small footprint. Again, this is how Datadog et al. work. The UF has been around forever and is stable. Keeping it up-to-date would just be releasing a new image, which almost always only entails updating the version in the Dockerfile.
The UF isn't different from any other metrics agent; if you're worried that you aren't getting metrics, you write an alert that expects metrics to be sent. You don't need to scale the UF. You only need one.
There was a problem hiding this comment.
I thought the UF was implemented as a sidecar to Dotcom? So it's being spun up / spun down as Dotcom is.
|
|
||
| - You maintain applications that aren't written in Elixir or want all of your applications to emit metrics in a standard format. | ||
|
|
||
| Every language has a library that emits metrics in the StatsD format; they are straightforward to set up. |
There was a problem hiding this comment.
question: what other languages do we use which are emitting metrics in StatsD format?
There was a problem hiding this comment.
We have a dotcom monitor that is written in Node. It was written in Node because it uses Playwright to run through critical user journeys and emits the time taken as metrics. Using Playwright allows us to reuse the same scenarios for end-to-end tests, load tests, and this monitoring. We also do health checks on our dependencies and emit those as metrics: 0 for down and 1 for up. That allows us to quickly calculate up-time over long periods.
There was a problem hiding this comment.
That's the only way it outputs information?
|
|
||
| For example, you want to know how many requests your application served per minute over the last hour. Using logs, you would send a log to Splunk for every request. Dotcom regularly receives 150 requests per second or 9,000 requests per minute. So, if you wanted to look at the span of an hour, you would query 540,000 logs and bin each log by its timestamp. Lastly, you would count each log in each bin. You can do this in Splunk, but it is slow. It gets slower and slower as you increase the time horizon or amount of data because logs are stored as documents optimized to be searched rather than calculated. | ||
|
|
||
| If you used metrics instead, your application would keep an internal count of the requests received. Every minute (tuneable per application), it would emit that number and a timestamp to Splunk before resetting itself. So, in a minute, it would emit the number 150 once. That is one request instead of the 9,000 above. Reviewing an hour of data would entail nothing more than looking at 60 numbers. Metrics are a much better approach to answering the question. |
There was a problem hiding this comment.
question: I tried this just now on Splunk: index=dotcom-prod-application state=set | timechart spam=1m count to get a chart of requests over an hour: "This search has completed and returned 61 results by scanning 526,174 events in 2.013 seconds".
How much faster do we need data to be?
There was a problem hiding this comment.
The numbers are to indicate the difference in magnitude. Here, it is 9,000:1. And, again, that 1 is stored as a time series, which is optimized to be read as a number in time. Try the same and extend the window to 7 days as you would for any kind of anomaly detection or manual analysis over time. It takes 2 minutes and 30 seconds to go over 57 million events. For the same span of time, you would look at 10,080 metrics. Again, optimized to be read that way.
There was a problem hiding this comment.
You can still optimize over multiple days (or longer); see above comment on when to deploy Dotcom.
paulswartz
left a comment
There was a problem hiding this comment.
suggestion: while it's helpful to track the discussions by putting replies into comments, they should also be incorporated into the body of the RFC. That way, future developers don't need to read through the entire PR history to get the relevant information: they can rely on the text of the document.
|
|
||
| For example, you want to know how many requests your application served per minute over the last hour. Using logs, you would send a log to Splunk for every request. Dotcom regularly receives 150 requests per second or 9,000 requests per minute. So, if you wanted to look at the span of an hour, you would query 540,000 logs and bin each log by its timestamp. Lastly, you would count each log in each bin. You can do this in Splunk, but it is slow. It gets slower and slower as you increase the time horizon or amount of data because logs are stored as documents optimized to be searched rather than calculated. | ||
|
|
||
| If you used metrics instead, your application would keep an internal count of the requests received. Every minute (tuneable per application), it would emit that number and a timestamp to Splunk before resetting itself. So, in a minute, it would emit the number 150 once. That is one request instead of the 9,000 above. Reviewing an hour of data would entail nothing more than looking at 60 numbers. Metrics are a much better approach to answering the question. |
There was a problem hiding this comment.
You can still optimize over multiple days (or longer); see above comment on when to deploy Dotcom.
| 3. **Traces** - are the representations of individual requests or transactions that flow through a system, which can help identify bottlenecks, dependencies, and root causes of issues. | ||
|
|
||
| TID engineers currently make extensive use of logging. | ||
| But, we don't currently have an established mechanism for collecting metrics or traces. |
There was a problem hiding this comment.
Is there another definition of metrics that talks about their storage and access? The definition you used above doesn't appear to include that.
| # Motivation | ||
|
|
||
| Logs are handy for debugging and other unstructured research like a security audit. | ||
| However, many TID developers have noted that some queries based on logs are incredibly slow, if not impossible, to run. |
There was a problem hiding this comment.
It's 3:30 - 4am, and it took under 10 seconds for 7 days worth of data; 30 days took 25 seconds. I'm sure a true timeseries database would be faster, but how often are we making these queries such that the extra speed is worth the complexity?
It sounds like knowledge about how to effectively query Splunk isn't well-distributed; I'll talk with Ryan about scheduling a lunch-and-learn sometime! This document with some ideas about what people are looking for will definitely be helpful.
| But, as noted above, logs are just one of three tools used to observe systems. | ||
| Metrics are optimized for storage and retrieval as numbers in a time series, which makes them cheap to store and fast to retrieve. | ||
|
|
||
| By adopting metrics, we can speed up slow queries, decrease the time necessary to generate dashboards and reports, and make previously impossible alerts possible. |
There was a problem hiding this comment.
We have a alert which does this for another application already: search for "Concentrate: Unusual Metric Drop" in the Splunk alerts.
| But, as noted above, logs are just one of three tools used to observe systems. | ||
| Metrics are optimized for storage and retrieval as numbers in a time series, which makes them cheap to store and fast to retrieve. | ||
|
|
||
| By adopting metrics, we can speed up slow queries, decrease the time necessary to generate dashboards and reports, and make previously impossible alerts possible. |
There was a problem hiding this comment.
I haven't seen an issue with dashboard queries taking a long time, so I was hoping you had examples of where metrics would measurably improve things. For example, the API and Dotcom dashboards seems to load quickly enough?
|
|
||
| By adopting metrics, we can speed up slow queries, decrease the time necessary to generate dashboards and reports, and make previously impossible alerts possible. | ||
|
|
||
| Furthermore, we can decrease costs by reducing the data we send to Splunk. |
There was a problem hiding this comment.
Are we going to stop logging a message for each request?
|
|
||
| - You maintain applications that aren't written in Elixir or want all of your applications to emit metrics in a standard format. | ||
|
|
||
| Every language has a library that emits metrics in the StatsD format; they are straightforward to set up. |
There was a problem hiding this comment.
That's the only way it outputs information?
| - You are concerned about your ECS resource usage. | ||
|
|
||
| The UF sidecar uses CPU and memory resources. | ||
| Though the footprint is small, you might be worried that increasing your compute usage might affect the rest of your cluster. |
There was a problem hiding this comment.
It's a sidecar though, correct? So it's additional resources (not many it sounds like), but some.
|
|
||
| You can argue that we do not need metrics and that adding a means to collect them increases the complexity of our technology stack. | ||
| However, we hope the limitations of a logs-only approach to observability have been made apparent by this RFC. | ||
| Furthermore, we hope that the promised benefits of metrics cause excitement. |
There was a problem hiding this comment.
I thought the UF was implemented as a sidecar to Dotcom? So it's being spun up / spun down as Dotcom is.
No description provided.